var vue = new Vue({
    el: "#app",
    data: {
        toasts: [],
        dest: {},
        catalogs: [],
        strategies: [],
        page: {}
    },
    methods: {
        commPage: function (page) {
            var param = getParams();
            var p = $("#travelForm").serialize() + "&destId=" + param.id + "&currentPage=" + page;
            //游记分页
            ajaxGet("/travel/query?" + p, {}, function (data) {
                var map = data.data;
                vue.page = map.page;
                buildPage(page, vue.page.totalPages, vue.doPage)
            })
        },
        doPage: function (page) {
            this.commPage(page);
        },
        conditionChange: function () {
            this.commPage(1);
        }
    },
    mounted: function () {
        var param = getParams();

        ajaxGet("/destination/detail", {id: param.id}, function (data) {
            var map = data.data;

            vue.toasts = map.toasts;//吐司
            vue.dest = map.dest;//目的地
            vue.catalogs = map.catalogs;//分类

            vue.strategies = map.strategies;//指定目的地下 点击率前三的攻略
            console.log(map.strategies);
        })

        //游记分页
        ajaxGet("/travel/query", {destId: param.id}, function (data) {
            var map = data.data;
            vue.page = map.page;
            buildPage(vue.page.number, vue.page.totalPages, vue.doPage)
        })
    }
});

